#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

int a[N],n,m,tot,cnt[N];

struct node{
	int a,b,c;
	void res(){if(a < b) swap(a,b); if(b < c) swap(b,c); if(a < b) swap(a,b);}
	node(int _a = 0,int _b = 0,int _c = 0):a(_a),b(_b),c(_c){res();}	
};
	
int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = in;
	sort(a+1,a+n+1);
	int m = 0;
	for(int i = 1;i <= n;i++)
		if(a[i] != a[m]) a[++m] = a[i],cnt[m] = 1;
		else cnt[m]++;
	priority_queue<pii> q;
	for(int i = 1;i <= m;i++) q.push(pii(cnt[i],a[i]));
	vector<node> ans;
	while(q.size() >= 3){
		pii x1 = q.top(),x2,x3; q.pop();
		x2 = q.top(); q.pop();
		x3 = q.top(); q.pop();
		tot ++;
		ans.pb(node(x1.se,x2.se,x3.se));
		x1.fi--; x2.fi--; x3.fi--;
		if(x1.fi) q.push(x1); if(x2.fi) q.push(x2); if(x3.fi) q.push(x3);
	}
	printf("%d\n",tot);
	for(int i = 0;i < tot;i++)
		printf("%d %d %d\n",ans[i].a,ans[i].b,ans[i].c);
	return 0;
}

